$(function(){
	active();
})
layui.use(['form', 'layedit', 'laydate','table'], function(){
  var table = layui.table
  ,laydate = layui.laydate
  ,form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit;
  
	$('.demoTable .layui-btn').on('click', function(){
		var type = $(this).data('type');
		active[type] ? active[type].call(this) : '';
	});
	
});
var whId;
function active(){
	whId=getParameter("whId");
	layui.use('table', function(){
		var table = layui.table;
		var $ = layui.$, active = {
				reload: function(){
					//执行重载
					table.reload('idTest', {
						page: {
							curr: 1 //重新从第 1 页开始
						}
					,where: {
						whId: whId,
					}
					});
				}
		};

		active['reload'] ? active['reload'].call(this) : '';
	});
}

function getParameter(param)
{
	var query = window.location.search;
	var iLen = param.length;
	var iStart = query.indexOf(param);
	if (iStart == -1)
		return "";
	iStart += iLen + 1;
	var iEnd = query.indexOf("&", iStart);
	if (iEnd == -1)
		return query.substring(iStart);

	return query.substring(iStart, iEnd);
}
/**
 * 渲染
 * @returns
 */
function load() {
	 var form = layui.form
	 form.render();
}